package cn.learn.delay.config;

import cn.learn.delay.core.RedisDelayTemplate;
import cn.learn.redis.config.RedisAutoConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.UUID;

/**
 * @author : 翌擎科技
 * @date : 2022/7/26 16:48
 */
@Configuration
@AutoConfigureAfter(RedisAutoConfiguration.class)
@Slf4j
public class RedisDelayAutoConfiguration {
    @Bean
    public RedisDelayTemplate redisDelayTemplate(RedisTemplate<String, Object> redisTemplate) {
        String uuid = UUID.randomUUID().toString();
        RedisDelayTemplate redisDelayTemplate = new RedisDelayTemplate(redisTemplate,uuid);
        // 添加拦截器
        return redisDelayTemplate;
    }

}
